package com.our.learning.infrastructure.po;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.ToString;

import java.util.Date;
import java.util.List;

/**
 * 试卷类
 * @author zhong
 * @date 2023/6/18
 */
@ToString
@TableName("t_paper")
public class Paper {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private String name;
    /** 试卷组卷类型，手动——1，自动——2 */
    private Integer type;
    private Integer sumScore;
    private Integer questionNum;
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;
    private String questions;
    private String answers;
    private Integer difficulty;
    @TableField(exist = false)
    private List<Question> questionList;

    public Paper() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getQuestionNum() {
        return questionNum;
    }

    public void setQuestionNum(Integer questionNum) {
        this.questionNum = questionNum;
    }

    public Integer getSumScore() {
        return sumScore;
    }

    public void setSumScore(Integer sum_score) {
        this.sumScore = sum_score;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getQuestions() {
        return questions;
    }

    public void setQuestions(String questions) {
        this.questions = questions;
    }

    public String getAnswers() {
        return answers;
    }

    public void setAnswers(String answers) {
        this.answers = answers;
    }

    public Integer getDifficulty() {
        return difficulty;
    }

    public void setDifficulty(Integer difficulty) {
        this.difficulty = difficulty;
    }

    public List<Question> getQuestionList() {
        return questionList;
    }

    public void setQuestionList(List<Question> questionList) {
        this.questionList = questionList;
    }

    public void addQuestion(Question question) {
        questionList.add(question);
    }
}
